﻿namespace Extensions.Services.RateLimit.Config;

public class RateLimitConfig
{
    public const string RateLimit = "RateLimit";
    /// <summary>
    /// 每次允许的数量
    /// </summary>
    public int PermitLimit { get; set; } = 100;
    /// <summary>
    /// 窗口时间(s)
    /// </summary>
    public int Window { get; set; } = 10;
    /// <summary>
    /// 指定补充令牌的最短期限(s)
    /// </summary>
    public int ReplenishmentPeriod { get; set; } = 2;
    /// <summary>
    /// 等待队列的长度
    /// </summary>
    public int QueueLimit { get; set; } = 0;
    /// <summary>
    /// 窗口的分区
    /// </summary>
    public int SegmentsPerWindow { get; set; } = 8;
    /// <summary>
    /// 最大令牌数
    /// </summary>
    public int TokenLimit { get; set; } = 100;
    /// <summary>
    /// 指定每次补充的最大令牌数。
    /// </summary>
    public int TokensPerPeriod { get; set; } = 10;

    /// <summary>
    /// 是否启动
    /// </summary>
    public bool Enable { get; set; } = false;
}